<?php

namespace catchAdmin\stock\model;

use catchAdmin\stock\model\search\InventorySearch;
use catcher\base\CatchModel;
use think\facade\Db;
/**
 *
 * @property int $id
 * @property string $inventory_id
 * @property string $config_id
 * @property int $number
 * @property int $box_number
 * @property int $isstatus
 * @property int $createtime
 * @property int $updatetime
 * @property string $status
 * @property int $disc_surplus
 * @property int $disc_deficit
 * @property string $remarks
 * @property int $admin_id
 * @property int $sort
 * @property int $total_number
 */
class InventoryStatementSon extends CatchModel
{

    public $field = [
        'id',
        'statement_id',
        'goods_id',
        'goods_name',
        'goods_Cname',
        'last_month_number',
        'this_month_in_number',
        'this_month_out_number',
        'current_number',
        'current_Good_Qty',
        'current_Hold_Qty',
        'current_NG_Qty',
        'created_at',
        'updated_at',
        'deleted_at',
        'tenant_id',
        'creator_id'
    ];

    public $name = 'db_inventory_statement_son';


    //无分页列表
    public function getNoPageList($statement_id,$tenant_id=0)
    {
        $where = [];
        if($tenant_id !== 0){
            $where[]=['tenant_id','=',$tenant_id];
        }
        $where[] = ['statement_id','=',$statement_id];

        $result =  $this->withoutField(['updated_at'], true)
            ->where($where)
            ->withoutField('tenant_id,creator_id,updated_at,deleted_at')
            ->order($this->aliasField('id'), 'desc')
            ->select()
            ->toArray();


        return $result;
    }
}